import { defHttp } from '/@/utils/http/axios'

import { ContractSO, ContractUploadBO, ContractUploadVO, ContractVO } from './model/contractModel'
import { BasicFetchResult, BasicPageParams } from '/@/api/model/baseModel'

enum Api {
  pageContract = '/contract/page',
  uploadContract = '/contract/upload',
  uploadContractFile = '/contract/uploadFile',
}

export const pageContractApi = (data: BasicPageParams<ContractSO>) => {
  return defHttp.post<BasicFetchResult<ContractVO>>(
    { url: Api.pageContract, data },
    { errorMessageMode: 'message' },
  )
}

export const uploadContractApi = (data: ContractUploadBO) => {
  return defHttp.post<BasicFetchResult<Boolean>>(
    { url: Api.uploadContract, data },
    { errorMessageMode: 'message' },
  )
}

export const uploadContractFileApi = () => {
  return defHttp.post<BasicFetchResult<ContractUploadVO>>(
    { url: Api.uploadContractFile },
    { errorMessageMode: 'message' },
  )
}
